package com.wngbms.config;

import com.wngbms.properties.CustomerProp;
import com.wngbms.service.CustomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(CustomerProp.class)
@ConditionalOnProperty(prefix = "custom", name = "isopen", havingValue = "true")
public class CustomConfig {

    @Autowired
    CustomerProp customerProp;

    @Bean()
    public CustomService customService() {
        return new CustomService(customerProp.getOsname(), customerProp.getArch());
    }

}
